<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib uri="/tld/dictionary" prefix="dictionary"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<title>已撮合债权</title>
<link rel="stylesheet" href="${ctx}/static/css/style.css" type="text/css" /> 
<link rel="stylesheet" href="${ctx}/static/css/style1.css" type="text/css" /> 
<link rel="stylesheet" href="${ctx}/static/css/kongjian.css" type="text/css" />
<link rel="stylesheet" href="${ctx}/static/css/jquery.ui.all.css" />
<link rel="stylesheet" href="${ctx}/static/css/m.css" type="text/css" />
<script src="${ctx}/static/script/jquery-1.4.min.js" type="text/javascript"></script>
<script src="${ctx}/static/script/jquery.ui.core.js"></script>
<script src="${ctx}/static/script/jquery.ui.datepicker.js"></script>
<script src="${ctx}/static/script/jsCoreUtil.js"></script>
<script src="${ctx}/static/script/jquery.form.js"></script>
<script type="text/javascript" src="${ctx}/static/script/jquery.blockUI.js" ></script>
</head>
<body>
<form:form id="mainForm2" action="${ctx}/recommend/recommend_add" modelAttribute="recommendInfoForm" method="post">
<input type="hidden" name="deliveryDate" id="deliveryDate" value="<fmt:formatDate value="${recommendInfoForm.deliveryDate}" type="date"/>" />
<input type="hidden"  id="id" name="id" value="${recommendInfoForm.id}"/>
<input type="hidden" name="investIdOld" id="investIdOld" value="${recommendInfoForm.investId}"/>
<input type="hidden" name="recommendValue" id="recommendValue" />
<input type="hidden" name="payType" id="payType" value="${recommendInfoForm.payType}"/>
<input type="hidden" name="returnId" id="returnId" value="${recommendInfoForm.returnId}"/>
   <!-- 
   <div class="shenqing2">
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
	      <tr>
            <td width="61">债权编号：</td>
            <td width="150px" style="color:#2E74D1;"><input type="text" class="ggkj_inputtext_80" value="11111" /></td>
            <td width="85">债务人：</td>
            <td width="150px" style="color:#2E74D1;"><input type="text" class="ggkj_inputtext_80" value=" 张" />
            </td>
			<td width="85">收益率：</td>
            <td width="150px" style="color:#2E74D1;"><input type="text" class="ggkj_inputtext_80" value="13%" />
            </td>
			<td width="85">借款产品：</td>
            <td width="150px" style="color:#2E74D1;"><input type="text" class="ggkj_inputtext_80" value="好产品" />
            </td>
			 <td width="93"><input name="Input" type="button" class="chaxun_btn" value="&nbsp;&nbsp;查询" />
             </td>
          </tr>
      </table>
    </div>
    -->
	<p style="padding-left:16px;">
		<!-- <a href="#" onclick="savesubmit();" style="border:1px solid #3b97e4; background:#fff; display:block; width:80px; height:20px; margin-right:15px; line-height:20px; background:#c6defa; color:#000; float:left; margin-top:10px;">保存</a> -->
		<input type="button" onclick="savesubmit();" id="recommend_save_button" name="recommend_save_button" value="保存" style="border:1px solid #3b97e4; background:#fff; display:block; width:80px; height:20px; line-height:20px; background:#c6defa; color:#000; float:left; margin-top:10px;"/>
	</p>
    <div style="clear:both;"></div>
	<div class="yiban">
<div id="mainform2table_div"></div>	
</div>

<script>

//已撮合数据
function ajaxsubmitHasRecommend(){
	var thisformm = document.getElementById('mainform2');
	var cssName = '';
	var td = '';
    var inde = 0;
	var table ='';
	
	for(var k=0;k<parent.RecommendErrorData.arr.length;k++){
		var key = parent.RecommendErrorData.arr[k].key;
		parent.RecommValueMap.remove(key.toString());
	}
	var zeor = new Array();
	for(var m=0;m<parent.RecommValueMap.arr.length;m++){
		key = parent.RecommValueMap.arr[m].key;
		if(parent.RecommValueMap.arr[m].value[0]==0){
			zeor[m]=key.toString();
		}
	}
	for(var m1=0;m1<zeor.length;m1++){
		parent.RecommValueMap.remove(zeor[m1]);
	}
	
	if(parent.RecommValueMap.arr.length>0){
		SettingButtonStyle('recommend_save_button',true);//display
	}
	if(parent.RecommValueMap.arr.length>0){
		SettingButtonStyle('recommend_save_button',false);//display
	}else{
		SettingButtonStyle('recommend_save_button',true);//display
	}
	
	var RecommValueMap = parent.RecommValueMap;
	
	
	table = table + "<table style='width:100%;' id='mainform2table' name='mainform2table' class='ggkj_table'  border='0' cellspacing='0' cellpadding='0'> ";
	table = table + createmainform2title();
	for(var i=0;i<RecommValueMap.arr.length;i++){
		var recommv = RecommValueMap.arr[i];
		 if(Number(i)%2==1){
		 	cssName = 'ggkj_tdColr';
		 }else{
		 	cssName = '';
		 }
		 inde++;
		 td = td + "<tr class='"+cssName+"' >";
	  	 td = td +"<td>"+(i+1)+"<input type='checkbox' name='_recommendid2' style='display:none;' value= '"+recommv.value[13]+"'/></td>";
		 td = td +"<td height='34'>"+recommv.value[5]+"</td>";
		 td = td +"<td height='34'>"+recommv.value[7]+"</td>";
		 td = td +"<td height='34'>"+recommv.value[8]+"</td>";
		 td = td +"<td height='34'>"+recommv.value[9]+"</td>";
		 td = td +"<td height='34'>"+recommv.value[10]+"</td>";
		 td = td +"<td height='34'>"+recommv.value[11]+"</td>";
		 td = td +"<td height='34'>"+recommv.value[12]+"</td>";
		 td = td +"<td height='34'>"+recommv.value[13]+"</td>";
		 td = td +"<td height='34'>"+parent.dictionary.get(recommv.value[14])+"</td>";
		 td = td +"<td height='34'>"+parent.dictionary.get(recommv.value[15])+"</td>";
		 td = td +"<td height='34'><input readonly='true' value='"+recommv.value[0]+"' size='10'/></td>";
		 td = td +"<td height='34'>"+recommv.value[16]+"</td>";
		 td = td + "</tr>";
	}
	
	for(var m=inde;m<10;m++){
		td = td + mainformInsertRow2Blank(m+1);
	}
	table =table +  td +  "</table>";
	document.getElementById('mainform2table_div').innerHTML = table;
}


/** 已撮合债权 start*/
function createmainform2title(){
	 var tableStr = '';
	 tableStr  = tableStr +"</tr>";
	 tableStr  = tableStr +"<th scope='col'>序号<input  type='checkbox' id='num' style='display:none;' name='num' onclick='javascript:allChecked("+'"mainform2"'+','+'"_recommendid2"'+");' /></th>";
	 tableStr  = tableStr +"<th scope='col'>债权编号</th>";
	 tableStr  = tableStr +"<th scope='col'>债务人</th>";
	 tableStr  = tableStr +"<th scope='col'>债务本金</th>";
	 tableStr  = tableStr +"<th scope='col'>可推荐比例</th>";
	 tableStr  = tableStr +"<th scope='col'>可推荐金额</th>";
	 tableStr  = tableStr +"<th scope='col'>还款期数</th>";
	 tableStr  = tableStr +"<th scope='col'>剩余期数</th>";
	 tableStr  = tableStr +"<th scope='col'>irr</th>";
	 tableStr  = tableStr +"<th scope='col'>还款日</th>";
	 tableStr  = tableStr +"<th scope='col'>借款产品</th>";
	 tableStr  = tableStr +"<th scope='col'>推荐金额</th>";
	 tableStr  = tableStr +"<th scope='col'>推荐比例</th>";
	 tableStr  = tableStr +"</tr>";
	 return tableStr;
}


//保存撮合数据
function ajaxsubmitSaveRecommend(){

}

function mainformInsertRow2Blank(tbIndex){
	 var cssName = '';
	 var td = '';
	 if(Number(tbIndex)%2==1){
	 	cssName = 'ggkj_tdColr';
	 }else{
	 	cssName = '';
	 }
	 td = td + "<tr class='"+cssName+"' >";
  	 td = td +"<td></td>";
	 td = td +"<td height='34'></td>";
	 td = td +"<td height='34'></td>";
	 td = td +"<td height='34'></td>";
	 td = td +"<td height='34'></td>";
	 td = td +"<td height='34'></td>";
	 td = td +"<td height='34'></td>";
	 td = td +"<td height='34'></td>";
	 td = td +"<td height='34'></td>";
	 td = td +"<td height='34'></td>";
	 td = td +"<td height='34'></td>";
	 td = td +"<td height='34'></td>";
	 td = td +"<td height='34'></td>";
	 td = td +"</tr>";
	 return td ;
}

function savesubmit(){
	var VString = AssemblyStringFromMapV(parent.RecommValueMap);
	SetValue('recommendValue',VString)
	SetValue('investIdOld',parent.document.getElementById('invsetId').value);
	SetValue('deliveryDate',parent.document.getElementById('deliveryDate').value);
	SetValue('payType',parent.document.getElementById('payType').value);
	SetValue('returnId',parent.document.getElementById('returnId').value);
	document.getElementById('mainForm2').submit();
}

 // unblock when ajax activity stops 
$(document).ready(function() { 
	tablename = 'no_recommend_table';
	ajaxsubmitHasRecommend();
}); 

</script>
</form:form>
 </body>
 </html> 